//
//  main.cpp
//  ConstructGccfg2.0
//
//  Created by Bryce Holton on 12/4/12.
//  Copyright (c) 2012 Bryce Holton. All rights reserved.
//

#include <iostream>
#include <memory>
#include <vector>
#include "Gccfg.h"
#include "UnitTestDriver.h"
#include "common.h"

using namespace std;

int main(int argc, const char * argv[])
{
    if (argc > 2)
    {
        vector<string> fileNames;
        
        for (int i = 2; i < argc; i++)
        {
            fileNames.push_back(argv[i]);
        }
        auto_ptr<Gccfg> generator(new Gccfg(argv[1], fileNames));
        
        generator->GenerateGraph();
        fileNames.clear();
    }
    else
    {
        cout << "Error: Usage -> gccfg <graph> <file names>" << endl;
    }

    return 0;
}

void SplitString(const string& str, vector<string>& tokens, const string& delimiters){
    // Skip delimiters at beginning.
    string::size_type lastPos = str.find_first_not_of(delimiters, 0);
    // Find first "non-delimiter".
    string::size_type pos     = str.find_first_of(delimiters, lastPos);
    
    while (string::npos != pos || string::npos != lastPos)
    {
        // Found a token, add it to the vector.
        tokens.push_back(str.substr(lastPos, pos - lastPos));
        // Skip delimiters.  Note the "not_of"
        lastPos = str.find_first_not_of(delimiters, pos);
        // Find next "non-delimiter"
        pos = str.find_first_of(delimiters, lastPos);
    }
}

